class Zcsh {
    public int rob(int[] nums) {
        int pre = 0;
        int current = 0;
        for (int value: nums) {
            int temp = current;
            current = Math.max(current, pre + value);
            pre = temp;
        }
        return current;
    }
}